/***************************************************************************
创建者：华磊
开始时间：               : 2019.12.13
copyright            : (C) 深圳市华友高科有限公司
 ***************************************************************************/
#include "connectionfunction.h"
#include "../beltTrackView/belttrackview.h"
#include "../fleetDebugView/fleetdebugview.h"
#include "../LaserCameraConfigView/lasercameraconfigview.h"
#include "../AxisSettingView/axissettingview.h"
#include "../CoupleControlView/couplecontrolview.h"
#include "filebackupdialog.h"
#include "filerestoredialog.h"
#include "weldpropertydialog.h"
#include "weldconditiondialog.h"
#include "weldsystemdialog.h"
#include "weavemotionconditiondialog.h"
#include "palletparametersettingview.h"

extern LaserCameraConfigView *g_laserCameraConfigView;
extern CoupleControlView *g_coupleControlView;
extern FleetDebugView *g_fleetDebugView;
extern AxisSettingView *g_axisSettingView;
extern BeltTrackView *g_beltTrackView;
extern MainWindow *g_mainWindow;
extern Delegate *loginDelegate;
extern MoveOperation *moveOperation;
extern FtpManage *ftpManage;
extern CommunicateNormalDelegate *communicateNormalThread;
extern CommunicateSaveDelegate *communicateSaveThread;
extern CommunicateUpdateDelegate *communicateThread;
extern CommunicateUpdateDelegate *communicateThreadLV3;
extern JoyStickDelegate *joystickDelegate;
extern Login *loginView;
extern LeftView *leftView;
extern LeftViewDelegate *leftviewdelegate;
extern RightView *rightView;
extern RightViewDelegate *rightviewdelegate;
#ifdef BUILD_ARM
extern DeviceDriver *deviceDriver;
#endif
extern BottomView *bottomView;
extern BottomViewDelegate *bottomviewdelegate;
#ifdef D_FOR_AGV
extern MapDelegate *mapDelegate;
extern MapView *mapView;
#endif

extern TopView *topView;
extern TopViewDelegate *topviewdelegate;
extern MultiRobotControlDlg *multiRobotControlDlg;
extern LeftFun *leftFun;
extern LeftFunDelegate *leftfundelegate;
extern RightFun *rightFun;
extern RightFunDelegate *rightfundelegate;
extern RunView *runView ;
extern RunDelegate *runDelegate;
extern JogView *jogView;
extern JogDelegate *jogDelegate;
extern ProgramView *programView;
extern ProgramDelegate *programDelegate;
extern SystemStatus *ioStatusView;
extern SystemStatusDelegate *systemStatusDelegate;
extern MessageView *messageView;
extern MessageDelegate *messageDelegate;
extern ProgramFileView *programFileView;
extern ProgramFileDelegate *programFileDelegate;
extern FileManage *fileManage;
extern FileManageDelegate *fileManageDelegate;
extern HomeMenuView *homeMenuView;
extern HomeMenuDelegate *homeMenuDelegate;
extern RobotSettingDlg *robotSettingDlg;
extern AgvSetDialog *agvSetDialog;
extern MiddleViewDelegate *middleViewDelegate;
extern ProgramLanguageTranslate *programLanguageTranslate;

ConnectionFunction::ConnectionFunction()
{
    qtConnect1();
    qtConnect2();
    qtConnect3();
    qtConnect4();
    qtConnectProgramRelate();
    qtConnectIoStatus();
    qtMenuRelate();
    qtMiddleRelate();
    qtRunRelate();
    qtCraftRelate();
}


void ConnectionFunction::qtConnect1()
{
    QObject::connect(homeMenuView,SIGNAL(setMaxJogTime_signal(int)),
                     moveOperation,SLOT(setMaxJogTimeSlot(int)));

    QObject::connect(moveOperation,SIGNAL(moveJogSignal(int,int)),
                     communicateSaveThread,SLOT(jogRunSlot(int,int)));//,Qt::BlockingQueuedConnection
    QObject::connect(moveOperation,SIGNAL(movePointSignal(MoveParameter)),
                     communicateSaveThread,SLOT(moveToPointSlot(MoveParameter)));//,Qt::BlockingQueuedConnection
    QObject::connect(moveOperation,SIGNAL(stopRunSignal()),
                     communicateSaveThread,SLOT(stopRun()));//,Qt::BlockingQueuedConnection
    QObject::connect(moveOperation,SIGNAL(ceaseRunSignal()),
                     communicateSaveThread,SLOT(pauseRunSlot()));//,Qt::BlockingQueuedConnection
    QObject::connect(moveOperation,SIGNAL(stopWatchDogSignal()),
                     communicateSaveThread,SLOT(stopWatchDog()));//,Qt::BlockingQueuedConnection
    QObject::connect(moveOperation,SIGNAL(runningDog()),
                     communicateNormalThread,SLOT(jogRunDogSlot()));//,Qt::BlockingQueuedConnection

    //其他
    QObject::connect(jogDelegate,SIGNAL(setRightViewCurrentAxis(int)),
                     rightviewdelegate,SLOT(changeCurrentAxis(int)));

}

void ConnectionFunction::qtConnect2()
{
    /* delegate 读取ini文件 获取ip 设置系统网络 设置语言显示(获取了所有的loginView变量)
     * 并且接下来的loginView->updateShow();会根据变量刷新界面
     */
    //连接delegate与通信处理:更新用户信息用;尝试连接;//不要使用Qt::BlockingQueuedConnection，卡界面
    //Qt::AutoConnection 可能导致ip更新不及时

    QObject::connect(loginDelegate,SIGNAL(callTmpInfoUpdate(QString)),
                     communicateNormalThread,SLOT(updateTmpInfo(QString)),Qt::BlockingQueuedConnection);
#ifdef D_FOR_AGV
    QObject::connect(loginDelegate,SIGNAL(controllerLoginSignal(QVector<int>,QVector<int>,QString,QString,int)),
                     mapView,SIGNAL(controllerLoginSignal(QVector<int>,QVector<int>,QString,QString,int)),Qt::AutoConnection);

#endif

    QObject::connect(loginDelegate,SIGNAL(callTmpInfoUpdate(QString)),
                     communicateSaveThread,SLOT(updateTmpInfo(QString)),Qt::BlockingQueuedConnection);
    QObject::connect(loginDelegate,SIGNAL(callTmpInfoUpdate(QString)),
                     communicateThread,SLOT(updateTmpInfo(QString)),Qt::DirectConnection);
//    QObject::connect(loginDelegate,SIGNAL(callTmpInfoUpdate(QString)),
//                     communicateThreadLV3,SLOT(updateTmpInfo(QString)),Qt::BlockingQueuedConnection);

    QObject::connect(loginDelegate,SIGNAL(tryToConnect_signal(QString)),
                     communicateThread,SLOT(tryToConnect(QString)),Qt::DirectConnection);
    QObject::connect(loginDelegate,SIGNAL(tryToConnect_signal(QString)),
                     communicateNormalThread,SLOT(tryToConnect(QString)),Qt::AutoConnection);

    QObject::connect(communicateNormalThread,SIGNAL(sendConnectResult_signal(int,QString)),
                     loginDelegate,SLOT(recvConnectResult(int,QString)),Qt::AutoConnection);

    QObject::connect(loginDelegate,SIGNAL(tryToFindIP()),
                     communicateNormalThread,SLOT(findConnect()),Qt::AutoConnection);
    QObject::connect(loginDelegate,SIGNAL(stopFindIP()),
                     communicateNormalThread,SLOT(stopFindConnect()),Qt::AutoConnection);
    QObject::connect(communicateNormalThread,SIGNAL(sendFindConnectResult(QVector<QString>)),
                     loginDelegate,SLOT(findIpResultSlot(QVector<QString>)));
    //语言
    QObject::connect(loginDelegate,SIGNAL(setLanguageSignal(int)),
                     communicateNormalThread,SLOT(setLanguageSlot(int)),Qt::AutoConnection);
    //获取并且打开缺省文件
    QObject::connect(loginDelegate->mountDelegate,SIGNAL(readDefaultFileNameSignal()),
                     communicateNormalThread,SLOT(readDefaultFileNameSlot()),Qt::AutoConnection);
    QObject::connect(loginDelegate, SIGNAL(controllerLanguageChangedSignal(int)),
                     g_mainWindow, SLOT(changeLanguageSlot(int)));

}

void ConnectionFunction::qtConnect3()
{
    //好像会导致gsoap通讯有问题，服务器socket句柄数一直增加。
    QObject::connect(bottomviewdelegate,SIGNAL(sendRunSignal()),
                     communicateSaveThread,SLOT(runSlot()),Qt::BlockingQueuedConnection);//BlockingQueuedConnection AutoConnection
//    QObject::connect(bottomviewdelegate,SIGNAL(sendRunSignal()),
//                     communicateNormalThread,SLOT(runSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(bottomviewdelegate,SIGNAL(sendStopSignal()),
                     communicateSaveThread,SLOT(stopRun()),Qt::BlockingQueuedConnection);
    QObject::connect(bottomviewdelegate,SIGNAL(sendPauseSignal()),
                     communicateSaveThread,SLOT(pauseRunSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(bottomviewdelegate,SIGNAL(sendReturnZeroSignal()),
                     communicateSaveThread,SLOT(returnZeroSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(bottomView,SIGNAL(button1Signal()),
                     leftView,SLOT(on_AutoBtn_clicked()));//run
    QObject::connect(bottomView,SIGNAL(button4Signal()),
                     leftView,SLOT(on_ManctlBtn_clicked()));//zero
#if BUILD_ARM
    QObject::connect(deviceDriver,SIGNAL(keyStartPress()),leftView,SLOT(on_AutoBtn_clicked()));//run
    QObject::connect(deviceDriver,SIGNAL(keyReturnZero()),leftView,SLOT(on_ManctlBtn_clicked()));//zero

    QObject::connect(deviceDriver,SIGNAL(keyStartPress()),bottomviewdelegate,SLOT(button1Slot()));
    QObject::connect(deviceDriver,SIGNAL(keyStartRelease()),bottomviewdelegate,SLOT(buttonDebugSlot()));
    QObject::connect(deviceDriver,SIGNAL(keyStop()),bottomviewdelegate,SLOT(button2Slot()));
    QObject::connect(deviceDriver,SIGNAL(keyPause()),bottomviewdelegate,SLOT(button3Slot()));
    QObject::connect(deviceDriver,SIGNAL(keyReturnZero()),bottomviewdelegate,SLOT(button4Slot()));


    QObject::connect(topviewdelegate,SIGNAL(setBuzzerPlay_signal()),deviceDriver,SLOT(setBuzzerPlay_slot()));
    QObject::connect(middleViewDelegate,SIGNAL(setBuzzerPlay_signal()),deviceDriver,SLOT(setBuzzerPlay_slot()));
#endif
}

void ConnectionFunction::qtConnect4()
{
    //连接delegate与通信处理:
    QObject::connect(topviewdelegate,SIGNAL(setAutoSpeedToServerSignal(float)),
                     communicateNormalThread,SLOT(setAutoSpeedSlot(float)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(setManSpeedToServerSignal(float)),
                     communicateNormalThread,SLOT(setManualSpeedSlot(float)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(setDebugRunModeSignal(int)),
                     communicateNormalThread,SLOT(setDebugModeSlot(int)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(setJointCoordinateSignal(int)),
                     communicateNormalThread,SLOT(setJointCoordinateSlot(int)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(setControlMaunalMode(int)),
                     communicateNormalThread,SLOT(setControlMaunalModeSlot(int)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(setCurrentToolCoordSianal(int)),
                     communicateNormalThread,SLOT(setCurrentToolCoordSlot(int)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(setCurrentUserCoordSianal(int)),
                     communicateNormalThread,SLOT(setCurrentUserCoordSlot(int)),Qt::AutoConnection);
    QObject::connect(topviewdelegate,SIGNAL(manualChangeSignal(int)),
                     communicateSaveThread,SLOT(setManualServonSlot(int)),Qt::AutoConnection);//使能
    //其余
//    QObject::connect(communicateThread,SIGNAL(topViewCoordSizeSignal()),
//                     topviewdelegate,SLOT(initNewCoordSlot()));
//    QObject::connect(topviewdelegate,SIGNAL(setRightViewName(bool , int , int , int)),
//                     rightviewdelegate,SLOT(changeJogAxisName_slot(bool , int , int , int)));
    QObject::connect(topView,SIGNAL(homeMenu() ),
                     leftView,SLOT(updateView()));//点击home后消除leftView高亮
    QObject::connect(topView,SIGNAL(useFilmSignal()),
                     g_mainWindow,SLOT(showFilmSlot()));
    QObject::connect(g_mainWindow,SIGNAL(hideAllTopView()),
                     topView,SLOT(hideAllTopViewSlot()));
    QObject::connect(topviewdelegate,SIGNAL(showMultiRobotControlDlg_signal()),
                     multiRobotControlDlg,SLOT(showThisDialog()));

#ifdef D_FOR_AGV
    QObject::connect(topView,SIGNAL(showMapView()),
                     mapView,SLOT(showMapViewDialog()));
#endif



    QObject::connect(rightfundelegate,SIGNAL(changeJogAxisName_signal(bool , int , int , int)),
                     jogDelegate,SIGNAL(changeJogAxisName_signal(bool , int , int , int)));
    QObject::connect(jogDelegate,SIGNAL(changeJogAxisName_signal(bool , int , int , int)),
                     rightviewdelegate,SLOT(changeJogAxisName_slot(bool , int , int , int)));
#ifdef BUILD_ARM
    //其他
    QObject::connect(deviceDriver,SIGNAL(keyFunctionR1Press()),rightfundelegate,SLOT(rightFunEmpty1Slot()));
    QObject::connect(deviceDriver,SIGNAL(keyFunctionR2Press()),rightfundelegate,SLOT(rightFunEmpty2Slot()));
    QObject::connect(deviceDriver,SIGNAL(keyFunctionR3Press()),rightfundelegate,SLOT(rightFunEmpty3Slot()));
    QObject::connect(deviceDriver,SIGNAL(keyFunctionR2Release()),rightfundelegate,SLOT(rightFunStopSlot()));
    QObject::connect(deviceDriver,SIGNAL(keyFunctionR3Release()),rightfundelegate,SLOT(rightFunStopSlot()));

    QObject::connect(deviceDriver,SIGNAL(velIncrease_signal()),topviewdelegate,SLOT(velIncrease_slot()));
    QObject::connect(deviceDriver,SIGNAL(velDecrease_signal()),topviewdelegate,SLOT(velDecrease_slot()));
    QObject::connect(deviceDriver,SIGNAL(stepModeChange_signal()),topviewdelegate,SLOT(stepModeChange_slot()));
    QObject::connect(deviceDriver,SIGNAL(jogCoordinateChange_signal()),topviewdelegate,SLOT(jogCoordinateChange_slot()));
    QObject::connect(deviceDriver,SIGNAL(jogCoordinateChangeTool_signal()),topviewdelegate,SLOT(jogCoordinateChangeTool_slot()));
    QObject::connect(deviceDriver,SIGNAL(robotChange_signal()),topviewdelegate,SLOT(robotChange_slot()));
    QObject::connect(deviceDriver,SIGNAL(servoOn_signal(int)),topviewdelegate,SLOT(servoOn_slot(int)));

    QObject::connect(deviceDriver,SIGNAL(clearMessage_signal()),messageDelegate,
                                                    SLOT(clearAllMessageSlot()));



#endif
#ifdef D_FOR_AGV
    QObject::connect(communicateThread,SIGNAL(runningProgramFileChanged()),
                     mapView,SLOT(showPointsInMap_Slot()));
    QObject::connect(runDelegate,SIGNAL(runningProgramFileChanged()),
                     mapView,SLOT(showPointsInMap_Slot()));
#endif


    QObject::connect(runDelegate,SIGNAL(clearCurrentProductivitySignal()),
                     communicateNormalThread,SLOT(clearCurrentProductionSlot()),Qt::AutoConnection);
    QObject::connect(runDelegate,SIGNAL(clearAccumulateProductivitySignal()),
                     communicateNormalThread,SLOT(clearAccumulatedProductionSlot()),Qt::AutoConnection);

    QObject::connect(runDelegate,SIGNAL(setProgramRunLineSignal(int)),
                     communicateNormalThread,SLOT(setProgramRunLineSlot(int)),Qt::AutoConnection);
    QObject::connect(rightfundelegate,SIGNAL(rightMoveToPointSignal(int)),
                     runDelegate,SLOT(rightFunMoveToPointSlot(int)));
    QObject::connect(rightfundelegate,SIGNAL(rightMoveStopSignal()),
                     runDelegate,SLOT(rightFunMoveStopSlot()));
}

void ConnectionFunction::qtConnectProgramRelate()
{
#ifdef D_FOR_AGV
    // 地图界面选择点位载入
    QObject::connect(mapView, SIGNAL(reordMapPointSignal(int)),
                     programView->moveFreeInstructionDelegate, SLOT(recordDPointSlot(int)));
    QObject::connect(programView->moveFreeInstructionDelegate, SIGNAL(pointChanged()),
                     mapView , SLOT(showPointsInMap_Slot()));
#endif


    //连接delegate与通信处理:点位移动/保存,通知控制器
//    QObject::connect(communicateNormalThread,SIGNAL(sendConnectResult_signal(int ,QString )),programDelegate,SLOT(initialMusicFileList()));
    QObject::connect(loginDelegate,SIGNAL(logInSucessSignal()),
                     programDelegate,SLOT(initialMusicFileList()));
//    QObject::connect(delegate,SIGNAL(logInSucessSignal()),
//                     mapView,SLOT(showMapViewDialog()));//agv使用,地图文件没有下载完成的时候去执行可能导致地图空白。
    QObject::connect(programDelegate,SIGNAL(saveFileAndUpdateCtrlSignal(QString,QString)),
                     communicateNormalThread,SLOT(saveFileAndUpdateCtrlSlot(QString,QString)),Qt::AutoConnection);
    QObject::connect(programDelegate,SIGNAL(setPrSignal(int,PointPro)),
                     communicateNormalThread,SLOT(recordPrSlot(int,PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(programView->motionInstructionDelegate,SIGNAL(changePointToDegCommSignal(PointPro)),
                     communicateNormalThread,SLOT(changePointTypeSlot(PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(programView->motionInstructionDelegate,SIGNAL(changePointToWorldCommSignal(PointPro)),
                     communicateNormalThread,SLOT(changePointTypeSlot(PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(programView->motionInstructionDelegate,SIGNAL(saveFileAndUpdateCtrlSignal(QString,QString)),
                     communicateNormalThread,SLOT(saveFileAndUpdateCtrlSlot(QString,QString)),Qt::BlockingQueuedConnection);
    QObject::connect(programView->motionInstructionDelegate,SIGNAL(setPrSignal(int,PointPro)),
                     communicateNormalThread,SLOT(recordPrSlot(int,PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(programView->palletInstructionDelegate,SIGNAL(saveFileAndUpdateCtrlSignal(QString,QString)),
                     communicateNormalThread,SLOT(saveFileAndUpdateCtrlSlot(QString,QString)),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(sendProPointChangeResult(PointPro)),
                     programView->motionInstructionDelegate,SLOT(recvChangePointAndSave(PointPro)));

    QObject::connect(programDelegate,SIGNAL(changePointToDegCommSignal(PointPro)),
                     communicateNormalThread,SLOT(changePointTypeSlot(PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(programDelegate,SIGNAL(changePointToWorldCommSignal(PointPro)),
                     communicateNormalThread,SLOT(changePointTypeSlot(PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(sendProPointChangeResult(PointPro)),
                     programDelegate,SLOT(recvChangePointAndSave(PointPro)));
    //其他
    QObject::connect(rightfundelegate,SIGNAL(rightMoveToPointSignal(int)),
                     programDelegate,SLOT(rightFunMoveToPointSlot(int)));
    QObject::connect(rightfundelegate,SIGNAL(rightMoveStopSignal()),
                     programDelegate,SLOT(rightFunMoveStopSlot()));
    QObject::connect(communicateThread,SIGNAL(editProgramSignal()),
                     programDelegate,SLOT(openFileEditSlot()));

    QObject::connect(programFileDelegate,SIGNAL(openFileEditSignal()),
                     programDelegate,SLOT(openFileEditSlot()));//打开文件后通知显示
    //通信对接
    QObject::connect(programFileDelegate, SIGNAL(openFileCommSignal(QString)),
                     communicateNormalThread,SLOT(openFileCommSlot(QString)),Qt::BlockingQueuedConnection);
    //其他
    QObject::connect(communicateThread,SIGNAL(proFileViewInitSignal()),
                     programFileDelegate,SLOT(updateMountFileSlot()));
#ifdef D_FOR_AGV
    // 读取文件获取地图点并显示
    QObject::connect(programFileDelegate, SIGNAL(showPointInMap()),
                     mapView, SLOT(showPointsInMap_Slot()));
    QObject::connect(programDelegate, SIGNAL(showPointInMap()),
                     mapView, SLOT(showPointsInMap_Slot()));
#endif


}

void ConnectionFunction::qtConnectIoStatus()
{
    //连接delegate与通信处理:io处理
    QObject::connect(systemStatusDelegate,SIGNAL(setDoSignal(int,bool)),
                     communicateNormalThread,SLOT(setDoSlot(int,bool)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setSoSignal(int,bool)),
                     communicateNormalThread,SLOT(setSoSlot(int,bool)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setAoSignal(int,float)),
                     communicateNormalThread,SLOT(setAoSlot(int,float)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setGrSignal(int,float)),
                     communicateNormalThread,SLOT(setGrSlot(int,float)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setGrClearSignal()),
                     communicateNormalThread,SLOT(cleanAllGrSLot()),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setRSignal(int,float)),
                     communicateNormalThread,SLOT(setRSlot(int,float)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setRClearSignal()),
                     communicateNormalThread,SLOT(cleanAllRSLot()),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setPrSignal(int,PointPro)),
                     communicateNormalThread,SLOT(recordPrSlot(int,PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(changePrPoint(int,PointPro)),
                     communicateNormalThread,SLOT(changePrTypeSlot(int,PointPro)),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(sendPrPointChangeResult(int,PointPro)),
                     systemStatusDelegate,SLOT(recvPrPointResultSlot(int,PointPro)));
    QObject::connect(systemStatusDelegate,SIGNAL(setPlSignal(int,float,float,float)),
                     communicateNormalThread,SLOT(setPlSlot(int,float,float,float)),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setPlClearSignal()),
                     communicateNormalThread,SLOT(cleanAllPlSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(systemStatusDelegate,SIGNAL(setTimeSignal(int,int)),
                     communicateNormalThread,SLOT(setTimeSlot(int,int)),Qt::BlockingQueuedConnection);
    //其他补充 待补充
    QObject::connect(communicateThread,SIGNAL(ioViewInitSignal()),
                     systemStatusDelegate,SLOT(initDataSlot()));
    // 　快捷方式暂停AGV小车暂停和停止运行
    //   消息提醒
    QObject::connect(g_mainWindow, SIGNAL(stopRun_signal()),
                     communicateSaveThread, SLOT(stopRun()),Qt::BlockingQueuedConnection);
    QObject::connect(g_mainWindow, SIGNAL(pauseRun_signal()),
                     communicateSaveThread, SLOT(pauseRunSlot()),Qt::BlockingQueuedConnection);
}

void ConnectionFunction::qtMenuRelate()
{
    //通信对接
    QObject::connect(homeMenuView,SIGNAL(showAgvSetParaDiagSignal()),
                     agvSetDialog,SLOT(showWindowSlot()));

    QObject::connect(homeMenuDelegate,SIGNAL(manualChangeSignal(int)),
                     communicateSaveThread,SLOT(setManualServonSlot(int)),Qt::BlockingQueuedConnection);
//    QObject::connect(homeMenuDelegate,SIGNAL(setAllCaliberSignal()),
//                     communicateNormalThread,SLOT(setAllCaliberSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(sendRegistNumToCtrl(QString)),
                     communicateNormalThread,SLOT(setRegisterNumberSlot(QString)),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(sendRegisterResult(ReturnRegisterStatus)),
                     homeMenuDelegate,SLOT(recvRegistrateResult(ReturnRegisterStatus)));
    QObject::connect(communicateNormalThread,SIGNAL(changePasswdResult(int)),
                     homeMenuDelegate,SLOT(recvChangePasswordResult(int)));
    QObject::connect(homeMenuDelegate,SIGNAL(sendToolCalculateData(int,HmiToolCoordinateInformation)),
                     communicateNormalThread,SLOT(calculateToolCoordinate(int,HmiToolCoordinateInformation)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(sendUserCalculateData(int,HmiUserCoordinateInformation)),
                     communicateNormalThread,SLOT(calculateUserCoordinate(int,HmiUserCoordinateInformation)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(passwordChangeSignal(int,QString,QString)),
                     communicateNormalThread,SLOT(changePasswordSlot(int ,QString,QString)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(getCalculateData(int)),
                     communicateNormalThread,SLOT(getToolCoordinateSlot(int)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(getCalculateData(int)),
                     communicateNormalThread,SLOT(getUserCoordinateSlot(int)),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(sendToolCoordinateData(QVector<HmiToolCoordinateInformation>)),
                     homeMenuDelegate,SLOT(initToolCoordinateData(QVector<HmiToolCoordinateInformation>)));
    QObject::connect(communicateNormalThread,SIGNAL(sendUserCoordinateData(QVector<HmiUserCoordinateInformation>)),
                     homeMenuDelegate,SLOT(initUserCoordinateData(QVector<HmiUserCoordinateInformation>)));
    QObject::connect(communicateNormalThread,SIGNAL(sendToolCalculateData(HmiToolCoordinateInformation)),
                     homeMenuDelegate,SLOT(recvCalculateToolDataSlot(HmiToolCoordinateInformation)));
    QObject::connect(communicateNormalThread,SIGNAL(sendUserCalculateData(HmiUserCoordinateInformation)),
                     homeMenuDelegate,SLOT(recvCalculateUserDataSlot(HmiUserCoordinateInformation)));
    QObject::connect(homeMenuDelegate,SIGNAL(sendCtrlSetIP(ControllerIpGroupInfo)),
                     communicateNormalThread,SLOT(changeCtrlIPSlot(ControllerIpGroupInfo)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(sendStartTypeSignal(int)),
                     communicateNormalThread,SLOT(setStartTypeSlot(int)),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(shutDownStart(int)),
                     homeMenuDelegate,SLOT(shutDownStartSlot(int)));
    QObject::connect(homeMenuDelegate,SIGNAL(sendShutDownSignal()),
                     communicateNormalThread,SLOT(shutDownSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(controllerShutDownEnableSignal(bool)),
                     communicateNormalThread,SLOT(controllerShutDownEnableSlot(bool)),Qt::BlockingQueuedConnection);

    // 主页文件模块显示文件管理
    QObject::connect(homeMenuDelegate, SIGNAL(showFileManage_Signal()),
                     fileManage, SLOT(showFileManageDialog_Slot()));
    QObject::connect(homeMenuDelegate,SIGNAL(signal_connectVrep(QString,int)),
                     communicateNormalThread,SLOT(connectVrep(QString,int)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(signal_disconnectVrep()),
                     communicateNormalThread,SLOT(disconnectVrep()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(signal_setVrepServoType(int)),
                     communicateNormalThread,SLOT(setVrepServoType(int)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(signal_setVrepIoType(int)),
                     communicateNormalThread,SLOT(setVrepIoType(int)),Qt::BlockingQueuedConnection);

    //hualei add,校准增加
    QObject::connect(homeMenuDelegate,SIGNAL(allowCalibrateJogSignal(bool)),
                     communicateNormalThread,SLOT(allowCalibrateJogSlot(bool)),Qt::BlockingQueuedConnection);
//    QObject::connect(homeMenuDelegate,SIGNAL(calibrateOneAxisSignal(int)),
//                     communicateNormalThread,SLOT(calibrateOneAxisSlot(int)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(getCalibrateInformationSingal()),
                     communicateNormalThread,SLOT(getCalibrateInformationSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread,SIGNAL(showCalibrateInfoSignal(S_AXISGROUP_ZERO_INFORMATION)),
                     homeMenuDelegate,SLOT(showCalibrateInfo(S_AXISGROUP_ZERO_INFORMATION)));
    //ethercat devices
    QObject::connect(homeMenuDelegate,SIGNAL(setMotorDcModeSignal(int)),
                     communicateNormalThread,SLOT(setMotorDcModeSlot(int)),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(clearMotorBatteryErrorSignal()),
                     communicateNormalThread,SLOT(clearMotorBatteryErrorSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(writeEthercatDeviceAliasSignal(int,int)),
                     communicateNormalThread,SLOT(writeEthercatDeviceAliasSlot(int,int)),Qt::BlockingQueuedConnection);

    QObject::connect(homeMenuDelegate,SIGNAL(getEthercatSlavesInformationSignal()),
                     communicateNormalThread,SLOT(getEthercatSlavesInformationSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(getMotionEngineDebugInfoSignal()),
                     communicateNormalThread,SLOT(getDebugInfo_motionServerSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(getPogramEngineDebugInfoSignal()),
                     communicateNormalThread,SLOT(getDebugInfo_programEngineSlot()),Qt::BlockingQueuedConnection);
    QObject::connect(homeMenuDelegate,SIGNAL(getTaskInfoSignal()),
                     communicateNormalThread,SLOT(getTaskInfoSlot()),Qt::BlockingQueuedConnection);

    QObject::connect(communicateNormalThread,SIGNAL(showEthercatSlavesInformationSignal(std::vector<EcatBusDevInfo_gsoap>)),
                     homeMenuDelegate,SLOT(showEthercatSlavesInformationSlot(std::vector<EcatBusDevInfo_gsoap>)));
    QObject::connect(communicateNormalThread,SIGNAL(showDebugInfo_motionServerSignal(MotionDebugInfo)),
                     homeMenuDelegate,SLOT(showDebugInfo_motionServerSlot(MotionDebugInfo)));
    QObject::connect(communicateNormalThread,SIGNAL(showDebugInfo_programEngineSignal(std::vector<ProgramEngineDebugInfo>)),
                     homeMenuDelegate,SLOT(showDebugInfo_programEngineSlot(std::vector<ProgramEngineDebugInfo>)));
    QObject::connect(communicateNormalThread,SIGNAL(showTaskInfoSignal(TaskManagerInfo)),
                     homeMenuDelegate,SLOT(showTaskInfoSlot(TaskManagerInfo)));
    QObject::connect(homeMenuDelegate,SIGNAL(showOtherSettingDlgSignal()),
                     robotSettingDlg,SLOT(show()));

    // 增加gsoap读写文件时临时窗口提醒
    QObject::connect(communicateNormalThread, SIGNAL(showFileOperatDialog_signal(int,QString,QString)),\
                     g_mainWindow, SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    //其他
    QObject::connect(topView,SIGNAL(homeViewMotorSignal(int)),
                     homeMenuView->manualServonDialog,SLOT(updateViewFromTopSlot(int)));
}

void ConnectionFunction::qtMiddleRelate()
{
    QObject::connect(middleViewDelegate, SIGNAL(saveProgramFile_signal()),programDelegate,SLOT(saveFileSlot()));


//    QObject::connect(leftfundelegate,SIGNAL(changeViewIDsignal(int)),
//                     middleViewDelegate,SLOT(setViewIDSlot(int)));

    QObject::connect(topviewdelegate,SIGNAL(changeViewIDsignal(int)),
                     middleViewDelegate,SLOT(setViewIDSlot(int)));
    QObject::connect(leftviewdelegate,SIGNAL(changeViewIDsignal(int)),
                     middleViewDelegate,SLOT(setViewIDSlot(int)));
    QObject::connect(bottomviewdelegate,SIGNAL(changeViewIDsignal()),
                     middleViewDelegate,SLOT(setViewIDFromReturnBtnSlot()));
    QObject::connect(programFileDelegate,SIGNAL(changeViewIDsignal(int)),
                     middleViewDelegate,SLOT(setViewIDSlot(int)));
    //middle通知jog delegate更新数据,jog delegate更新数据并且调用view的updateView函数
    QObject::connect(middleViewDelegate,SIGNAL(updateBottomStatus(int)),
                     bottomviewdelegate,SLOT(updateViewSlot(int)));
    QObject::connect(middleViewDelegate,SIGNAL(updateRunningView()),
                     runDelegate,SLOT(updateDataAndView()));
    QObject::connect(middleViewDelegate,SIGNAL(updateProView()),
                     programFileDelegate,SLOT(updateMountFileSlot()));
    QObject::connect(middleViewDelegate,SIGNAL(updateJogView()),
                     jogDelegate,SLOT(updateDataAndView()));
    QObject::connect(middleViewDelegate,SIGNAL(updateIoView()),
                     systemStatusDelegate,SLOT(updateViewAndData()));
    QObject::connect(middleViewDelegate,SIGNAL(updateMsgView()),
                     messageDelegate,SLOT(updateDataAndView()));
    QObject::connect(middleViewDelegate,SIGNAL(showRegisterDialogSignal()),
                     homeMenuDelegate,SLOT(showRegisterSlot()));
    QObject::connect(middleViewDelegate,SIGNAL(changeLeftView(int)),
                     leftView,SLOT(midChangeViewClicked(int)));//点击 左侧的 信息按钮

    //robotChanged_signal
    QObject::connect(topviewdelegate,SIGNAL(robotChanged_signal()),
                     programFileDelegate,SLOT(updateMountFileSlot()));
    QObject::connect(topviewdelegate,SIGNAL(robotChanged_signal()),
                     jogDelegate,SLOT(updateDataAndView()));
    QObject::connect(topviewdelegate,SIGNAL(robotChanged_signal()),
                     communicateThread,SLOT(updateControllerInfo_ioInitial()));
//    QObject::connect(middleViewDelegate,SIGNAL(updateIoView()),
//                     systemStatusDelegate,SLOT(updateViewAndData()));

    //2017.04.18 mount的提醒操作 集中在hmi comm中
//    QObject::connect(delegate,SIGNAL(midDelegateUpdateMountSignal()),middleViewDelegate,SLOT(clearTimeProFileTreeCountSLot()));
//    QObject::connect(topviewdelegate,SIGNAL(midDelegateUpdateMountSignal()),middleViewDelegate,SLOT(clearTimeProFileTreeCountSLot()));
    //膜
    QObject::connect(middleViewDelegate,SIGNAL(useFilmSignal()),
                     g_mainWindow,SLOT(showFilmSlot()));
    QObject::connect(middleViewDelegate,SIGNAL(unUseFileSianal()),
                     g_mainWindow,SLOT(hideFilmSlot()));
    qDebug()<<"mid init";

    //中间其他窗口-消息框
#ifdef D_FOR_AGV
    QObject::connect(g_mainWindow, SIGNAL(disableJog_signal()),
                     mapView,SLOT(disableVehicleJog_slot()),Qt::DirectConnection);
#endif

    QObject::connect(moveOperation, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    //
    QObject::connect(loginDelegate,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(loginDelegate,SIGNAL(msgBoxCloseSignal()),
                     g_mainWindow,SLOT(closeMsgBoxSlot()));
    QObject::connect(loginDelegate->mountDelegate,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(topviewdelegate,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));//提示断线
    QObject::connect(bottomviewdelegate ,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(leftfundelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(rightfundelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    //
    QObject::connect(runDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    //QObject::connect(jogDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programFileView, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programFileDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programDelegate, SIGNAL(msgBoxGsoapWrite_Signal(int,QString,QString)),
                     g_mainWindow, SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programView->motionInstructionDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programView->motionInstructionView, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(programView->palletInstructionDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(systemStatusDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(homeMenuDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(homeMenuDelegate->systemCmdDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(homeMenuView->fileBackUpDialog,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(homeMenuView->fileRestoreDialog,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(homeMenuView->setcoordinatedialog,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(homeMenuView->passwordModiyDialog,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
#ifdef D_FOR_AGV
    QObject::connect(mapView,SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
#endif

    QObject::connect(programDelegate, SIGNAL(openUserProgramFile_signal(QString)),
                     programFileDelegate,SLOT(openFileSlot(QString)));
    QObject::connect(&fileData, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));

    QObject::connect(programView->moveFreeInstructionDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow, SLOT(showMsgBoxTypeSlot(int,QString,QString)));

    QObject::connect(ftpManage, SIGNAL(showFtpGetDialog()),
                     g_mainWindow, SLOT(showFtpDialog()));
    QObject::connect(ftpManage, SIGNAL(showFtpPutDialog()),
                     g_mainWindow, SLOT(showFtpDialog()));

    QObject::connect(ftpManage, SIGNAL(ftpError_signal(QString)),
                     fileManageDelegate, SLOT(ftpError_slot(QString) ) );

    QObject::connect(ftpManage, SIGNAL(getFileInServerDirectory(QHash<QString,bool>,QString,QString)),
                     fileManageDelegate, SLOT(getFileList_Slot(QHash<QString,bool>,QString,QString)));
    QObject::connect(ftpManage, SIGNAL(isGetFile(bool,QString)),
                     fileManageDelegate, SLOT(isGetFileFinished_Slot(bool,QString)));
    QObject::connect(ftpManage, SIGNAL(isPutFile(bool,QString)),
                     fileManageDelegate, SLOT(isPutFileFinished_Slot(bool,QString)));
    QObject::connect(ftpManage, SIGNAL(isRemoveFile(bool,QString)),
                     fileManageDelegate, SLOT(removeFtpFile_Slot(bool,QString)));
    QObject::connect(fileManage, SIGNAL(downloadFile_Signal()),
                     fileManageDelegate, SLOT(downloadFile_Slot()));
    QObject::connect(fileManage, SIGNAL(uploadFile_Signal()),
                     fileManageDelegate, SLOT(uploadFile_Slot()));
    QObject::connect(fileManage, SIGNAL(getFileList_Signal(QString)),
                     fileManageDelegate, SLOT(getFileListInfo_Slot(QString)));
    QObject::connect(fileManage, SIGNAL(setLocalFileDir_signal(QString)),
                     fileManageDelegate, SLOT(setLocalFileDir_slot(QString)));
    QObject::connect(fileManage, SIGNAL(removeLocalFile_Signal()),
                     fileManageDelegate, SLOT(removeLocalFile_Slot()));
    QObject::connect(fileManage, SIGNAL(removeRemoteFile_Signal()),
                     fileManageDelegate, SLOT(removeRemoteFile_Slot()));

#ifdef BUILD_ARM
    QObject::connect(deviceDriver, SIGNAL(msgBoxSignal(int,QString,QString)),g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(deviceDriver, SIGNAL(closeBoxSignal()),g_mainWindow,SLOT(closeMsgBoxSlot()));
#endif
    QObject::connect(middleViewDelegate, SIGNAL(msgBoxSignal(int,QString,QString)),
                     g_mainWindow,SLOT(showMsgBoxTypeSlot(int,QString,QString)));
    QObject::connect(middleViewDelegate, SIGNAL(closeMsgBoxSignal()),
                     g_mainWindow,SLOT(closeMsgBoxSlot()));

    QObject::connect(jogView,SIGNAL(manualChangeSignal(int)),
                     communicateSaveThread,SLOT(setManualServonSlot(int)),Qt::AutoConnection);//使能
    QObject::connect(jogView,SIGNAL(setDragControl_signal(bool)),
                     communicateSaveThread,SLOT(setDragControl_slot(bool)),Qt::AutoConnection);
    QObject::connect(jogView,SIGNAL(clearMsgAndServoOn_signal()),
                     communicateNormalThread,SLOT(clearMsgAndServoOn()),Qt::BlockingQueuedConnection);

    QObject::connect(jogView,SIGNAL(displayJoyStickView_signal(bool)),
                     joystickDelegate,SLOT(displayJoyStickView_slot(bool)),Qt::DirectConnection);
    qDebug()<<"msgBox init";
}

void ConnectionFunction::qtRunRelate()
{
#ifdef D_FOR_AGV
    QObject::connect(loginDelegate, SIGNAL(loginControllerSucess_signal()),
                     mapView, SLOT(loginControllerSucess_slot()));
#endif

    //补充 language
    ////delegate 手动切换(下拉选择语言)的时候只修改了变量(同时修改login mian界面的显示);
    ////其他界面 只有确认登录成功后才触发信号槽 修改显示
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     leftView, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     leftFun, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     bottomviewdelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     rightfundelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     topviewdelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     runDelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     programDelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     jogDelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     programFileDelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     messageView, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     systemStatusDelegate, SLOT(changeLanguageSlot(int)));

    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     homeMenuDelegate, SLOT(changeLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     middleViewDelegate, SLOT(changeLanguageSlot(int)));

    QObject::connect(loginDelegate, SIGNAL(setLanguageSignal(int)),
                     moveOperation, SLOT(changeLanguageSlot(int)));

    QObject::connect(loginDelegate, SIGNAL(setEditLanguageSignal(int)),
                     programDelegate ,SLOT(changeEditLanguageSlot(int)));
    QObject::connect(homeMenuDelegate, SIGNAL(setEditLanguageSignal(int)),
                     programDelegate ,SLOT(changeEditLanguageSlot(int)));
    QObject::connect(loginDelegate, SIGNAL(setEditLanguageSignal(int)),
                     runDelegate ,SLOT(changeEditLanguageSlot(int)));
    QObject::connect(homeMenuDelegate, SIGNAL(setEditLanguageSignal(int)),
                     runDelegate ,SLOT(changeEditLanguageSlot(int)));

    // gosap获取日志文件信息
    QObject::connect(homeMenuDelegate, SIGNAL(requastGetLogInfo_Signal()),
                     communicateNormalThread, SLOT(getLogFileInfo_Slot()),Qt::BlockingQueuedConnection);
    QObject::connect(communicateNormalThread, SIGNAL(sendLogFileInfo_Signal(QVector <Message>)),
                     homeMenuDelegate, SLOT(getRobotLogFile_Slot(QVector <Message>)));

    //连接delegate与通信处理:信息清除处理
    QObject::connect(messageDelegate,SIGNAL(clearMsgSignal(int)),
                     communicateNormalThread,SLOT(cleanMsgSLot(int)),Qt::BlockingQueuedConnection);
    QObject::connect(messageDelegate,SIGNAL(clearAllMsgSignal()),
                     communicateNormalThread,SLOT(cleanAllMsgSlot()),Qt::BlockingQueuedConnection);

    QObject::connect(messageDelegate,SIGNAL(errorChangeModelSignal(int)),
                     communicateNormalThread,SLOT(setControlMaunalModeSlot(int)),Qt::BlockingQueuedConnection);

    QObject::connect(messageView,SIGNAL(clearMsgAndServoOn_signal()),
                     communicateNormalThread,SLOT(clearMsgAndServoOn()),Qt::BlockingQueuedConnection);

    QObject::connect(rightviewdelegate,SIGNAL(changeViewJog()),
                     leftView,SLOT(on_ManctlBtn_clicked()));
#ifdef BUILD_ARM
    //其他
    QObject::connect(deviceDriver,SIGNAL(setRightViewCurrentAxis(int)),rightviewdelegate,SLOT(changeCurrentAxis(int)));
#endif
}

void ConnectionFunction::qtCraftRelate()
{
    QObject::connect(homeMenuDelegate, SIGNAL(showBeltTrackView_signal()),
                     g_beltTrackView, SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate, SIGNAL(showFleetDebugView_signal()),
                     g_fleetDebugView, SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate, SIGNAL(showLaserCameraConfigView_signal()),
                     g_laserCameraConfigView, SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate,SIGNAL(showWeldPropertyView_signal()),
                     homeMenuView->weldPropertyDialog,SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate,SIGNAL(showPalletSettingView_signal()),
                     homeMenuView->palletSetDialog,SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate,SIGNAL(showWeldConditionView_signal()),
                     homeMenuView->weldConditionDialog,SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate,SIGNAL(showWaveMotionConditionView_signal()),
                     homeMenuView->weaveConditionDialog,SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate,SIGNAL(showWeldSystemConfigView_signal()),
                     homeMenuView->weldSystemDialog,SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate, SIGNAL(showAxisSettingView_signal()),
                     g_axisSettingView, SLOT(showView_slot()));
    QObject::connect(homeMenuDelegate, SIGNAL(showCoupleControlView_signal()),
                     g_coupleControlView, SLOT(showView_slot()));


    QObject::connect(g_laserCameraConfigView,SIGNAL(moveToCoordinatePointPress(MoveParameter)),
                     homeMenuDelegate,SLOT(moveToCoordinatePointPressSlot(MoveParameter)));
    QObject::connect(g_laserCameraConfigView,SIGNAL(moveToCoordinatePointRelease()),
                     homeMenuDelegate,SLOT(moveToCoordinatePointReleaseSlot()));



}

